POV-Ray : Newsgroups : povray.programming : POV-Ray parser in Java : Re: POV-Ray parser in Java Server Time
21 Jul 2024 10:28:44 EDT (-0400)
  Re: POV-Ray parser in Java  
From: Vadim Sytnikov
Date: 9 Jan 2003 06:34:08
Message: <3e1d5e30@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote:
> This is only true for ISO C, not ISO C++.  In C++ all C macros are
required
> to be functions; and when using "cname" instead of "name.h" headers they
are
> even placed in the std namespace.  POV-Ray 3.5 is a C++ program.

Strictly speaking, that's so, but POV-Ray still uses <stdio.h>, and I see no
reasons not to just change fgetc() to getc() -- if that is indeed a
bottleneck, as you said.

> Apart from that the lastest revision of C, ISO C 99 explicitly notes that
> getc may be either a function or a macro.  In reality, it is even so that
> some libraries implement it in terms of exactly the same code fgetc
uses...

IIRC, it (ISO C) did so for ages. And yet in reality all the compilers I'm
aware of always had a macro version of getc(). My current versions of VC and
GCC certainly do. ICC (Intel's Proton) that I used to run just used MS's
include files, so it also did. So if fgetc() is a bottleneck (as you said),
and you just change fgetc() to getc(), we would have free speed improvement.
It won't help my own version though, since I use multi-threading, and
getc/putc macros are, obviously, unusable in that mode. But as to the
official version... Or are use using MT library as well?

BTW, there are currently only 4 calls of fgetc() in POV-Ray sources (inline
function in file_pov.h, plus method of pov_istream_class in file_pov.cpp).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.